package com.atguigu.springcloud.api;

import com.atguigu.springcloud.entities.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

// @FeignClient 注解专门用于标记 Feign 接口
// value 属性：当前 Feign 接口对应 Provider 微服务的名称
@FeignClient(value = "cloud-payment-service")
public interface FeignPaymentClient {

    // 接口中和被调用的方法对应的方法建议直接从 Provider 那边复制过来，做一些调整即可
    // 在调用目标方法时，不需要我们 Consumer 这边传入的参数去掉，其它声明保持一致即可
    @PostMapping(value = "/payment/create")
    CommonResult<Integer> create(@RequestBody Payment payment);

    @GetMapping(value = "/payment/get/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

}
